package com.onesports.intelligent.k12.polarlight.domain.dto.course;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.ArrayTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * @author FPH
 * @since 2022年7月10日19:51:13
 * 课程管理保存修改通用dto
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseManegeSaveOrUpdateDTO {

    @ApiModelProperty("Id")
    private String id;

    @ApiModelProperty("课程名称")
    @NotBlank(message = "课程名称不可为空")
    @Length(message = "长度大于0小于50",max = 50)
    private String courseName;

    @ApiModelProperty("课程分类id")
    @NotBlank(message = "课程分类id不可为空")
    private String courseClassifyId;

    @ApiModelProperty("课程分阶id")
    @NotBlank(message = "课程分阶id不可为空")
    private String courseSubLevelId;

    @ApiModelProperty("课程小图")
    @NotBlank(message = "课程小图不可为空")
    private String imgUrl;

    @TableField(value = "main_url",typeHandler = ArrayTypeHandler.class,jdbcType = JdbcType.ARRAY)
    @ApiModelProperty("课程主图")
    @NotEmpty(message = "课程主图不可为空")
    private String[] mainUrl;

    @ApiModelProperty("课程详情")
    @NotBlank(message = "课程详情不可为空")
    @Length(message = "长度大于0小于5000",max = 5000)
    private String courseDetail;

    @ApiModelProperty("拼班类型ID与其对应的价格")
    @NotEmpty(message = "拼班类型ID与其对应的价格不可为空")
    @Valid
    private List<ClassMergeRuleIdAndPriceDTO> classMergeRuleIdAndPriceList;
}
